package dragon.tagext.sys.config;

import java.io.IOException;

import javax.servlet.jsp.JspContext;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.SimpleTagSupport;

import dragon.core.util.StringUtils;
import dragon.modules.system.config.dao.SysConfig;

public class Config extends SimpleTagSupport {

	private String parameter;

	@Override
	public void doTag() throws JspException, IOException {

		if (StringUtils.isEmpty(parameter)) {
			return;
		} else {
			parameter = parameter.trim();
		}

		JspContext jspContext = getJspContext();
		JspWriter out = jspContext.getOut();
		out.print(SysConfig.getParameter(parameter));
	}

	/**
	 * @param parameter
	 *            参数名
	 */
	public void setParameter(String parameter) {
		this.parameter = parameter;
	}

}
